<div class=" contentr_2 fr">
    <div class="cr">
        <p >发布任务-发布内容</p>
    </div>
    <div>
        <form action="" class="mt10" method="post" id="form1" name="form1">
            <div>
                <label class="xlabel_2 mt15">绑定商铺:</label>
                <select name="shop_id" class=" kuang3" style="width: auto;">
                    <?php foreach($shop as $s){ ?>
                    <option value="<?php echo $s->id; ?>" <?php if($tpl->shop_id==$s->id){ ?>selected<?php } ?>><?php echo $s->shop; ?></option>
                    <?php } ?>
                </select>
                <em>掌柜号即卖家旺旺号</em>
            </div>
            <div>
                <label class="xlabel_2 mt15">总金额:</label>
                <input name="total_money" class=" kuang4" type="text" value="<?php echo $tpl->total_money; ?>" />
                <em>元，请填写任务总金额，只能输入数字1-5000（远程付款的请输入1）</em></div>
            <div>
                <label class="xlabel_2 mt15">任务佣金:</label>
                <input name="commission" class=" kuang4" type="text" value="<?php echo $tpl->commission; ?>" />
                <a href="javascript:void(0)" class="pay_btn" >查看佣金规则</a>
            </div>
            <div id="c">
                <label class="xlabel_2 mt15">关键搜索词：</label>
                <input type="text" name="keyword_0" class="kuang4" value="<?php echo $tpl->keywords; ?>" />
            </div>
            <input type="button" id="e" value="添加"  class="ml145"/>
            <br />
            <script language="javascript">
                var i = 1;
                document.getElementById("e").onclick=function(){
                    document.getElementById("c").innerHTML+="<div id=kdiv_"+i+"><input name='keyword_"+i+"' type='text' style='margin-left:144px;margin-top:5px;' class='kuang4' /><input type='button' value='删除' onclick='del1("+i+")' /></div>";
                    i = i + 1;
                }
                function del1(o){
                    document.getElementById("c").removeChild(document.getElementById("kdiv_"+o));
                }
            </script>
            <div>
                <label class="xlabel_2 mt15">上传图片:</label>
                <input type="file" id="fileupload1" style="width:180px;" />
                <input type="button" value="上传" onclick="doupload(1);" />
                <input type="hidden" name="img_thumb" id="img_thumb1" value="<?php echo $tpl->img_thumb; ?>" />
                <font color="red">（上传小于500KB的图片;若图片无法显示，则请把图修改为JPG格式）</font> <span id="lblpicmsg" style="color:Red;"></span>
                <div style="position:relative;">
                    <div id="imginfo"><img src=""></div>
                </div>
                <div id="imglist">
                    <p class="ml145 mt15"><img src="<?php if(empty($tpl->img_thumb)){ ?>/static/images/renwutupian.jpg<?php }else{ echo $tpl->img_thumb; } ?>" id="thumb1" width="215px" height="230px" /></p>
                </div>
            </div>
            <div id="d">
                <label class="xlabel_2 mt15">任务详细要求：</label>
                <textarea rows="4" cols="70" name="ask_0" style="margin-top:5px;"><?php echo $tpl->detail; ?></textarea>
            </div>
            <input type="button" id="b" value="添加"  class="ml145" />
            <br />
            <script language="javascript">
                var j = 1;
                document.getElementById("b").onclick=function(){
                    document.getElementById("d").innerHTML+="<div id=adiv_"+j+"><textarea rows='4' cols='70' name='ask_"+j+"' type='text' style='margin-left:144px;margin-top:5px;' ></textarea><input type='button' value='删除' onclick='del2("+j+")' /></div>";
                    j = j + 1;
                }
                function del2(o){
                    document.getElementById("d").removeChild(document.getElementById("adiv_"+o));
                }
            </script>
    </div>
    <div>
        <label class="xlabel_2 mt15">浏览方式:</label>
        <input type="radio" name="look_way" value="1" <?php if($tpl->look_way==1||empty($tpl->look_way)){ ?>checked<?php } ?> />
        <i>电脑浏览</i>
        <input type="radio" name="look_way" value="2" <?php if($tpl->look_way==2){ ?>checked<?php } ?> />
        <i>手机浏览</i>
    </div>
    <div class="mt15">
        <label class="xlabel_2">浏览时间:</label>
        <select name="look_time" class="kuang5">
            <?php for($i=1;$i<=5;$i++){ ?>
            <option value="<?php echo $i; ?>" <?php if($tpl->look_time==$i){ ?>selected<?php } ?>><?php echo $i; ?>分钟</option>
            <?php } ?>
        </select>
    </div>
    <div>
        <label class="xlabel_2 mt15">是否收藏:</label>
        <input type="radio" name="iscollect" value="1" <?php if($tpl->iscollect==1||empty($tpl->iscollect)){ ?>checked<?php } ?> />
        <i>是</i>
        <input type="radio" name="iscollect" value="2" <?php if($tpl->iscollect==2){ ?>checked<?php } ?> />
        <i>否</i>
    </div>
    <div>
        <label class="xlabel_2 mt15">是否关注:</label>
        <input type="radio" name="isfocus" value="1" <?php if($tpl->isfocus==1||empty($tpl->isfocus)){ ?>checked<?php } ?> />
        <i>是</i>
        <input type="radio" name="isfocus" value="2" <?php if($tpl->isfocus==2){ ?>checked<?php } ?> />
        <i>否</i>
    </div>
    <div>
        <label class="xlabel_2 mt15">手机浏览:</label>
        <input type="radio" name="ismobile" value="1" <?php if($tpl->ismobile==1){ ?>checked<?php } ?> />
        <i>是</i>
        <input type="radio" name="ismobile" value="2" <?php if($tpl->ismobile==2||empty($tpl->ismobile)){ ?>checked<?php } ?> />
        <i>否</i>
    </div>
    <div>
        <label class="xlabel_2 mt15">返款方式:</label>
        <input type="radio" name="return_way" value="1" <?php if($tpl->return_way==1){ ?>checked<?php } ?> />
        <i>财付通转账</i>
        <input type="radio" name="return_way" value="2" <?php if($tpl->return_way==2||empty($tpl->return_way)){ ?>checked<?php } ?> />
        <i>支付宝转账</i>
        <input type="radio" name="return_way" value="3" <?php if($tpl->return_way==3){ ?>checked<?php } ?> />
        <i>支付宝转账银行</i>
        <input type="radio" name="return_way" value="4" <?php if($tpl->return_way==4){ ?>checked<?php } ?> />
        <i>支付宝收款</i>
        <input type="radio" name="return_way" value="5" <?php if($tpl->return_way==5){ ?>checked<?php } ?> />
        <i>财付通收款</i> <em class="ml5">（收款产生手续费商家须承担）</em> </div>
    <div class="mt15">
        <label class="xlabel_2">返款时间:</label>
        <select name="return_time" class=" kuang5">
            <?php for($i=1;$i<=20;$i++){ ?>
                <option value="<?php echo $i; ?>" <?php if($tpl->return_time==$i){ ?>selected<?php } ?>><?php echo $i; ?>小时</option>
            <?php } ?>
        </select>
        <em>选择正确的返款时间（当天的任务必须当天返款）</em></div>
    <div class="mt15">
        <label class="xlabel_2">自动取消任务时间:</label>
        <select name="auto_cancel" class=" kuang5">
            <?php for($i=1;$i<=10;$i++){ ?>
            <option value="<?php echo $i; ?>" <?php if($tpl->auto_cancel==$i){ ?>selected<?php } ?>><?php echo $i; ?>小时</option>
            <?php } ?>
        </select>
        <em> 请选择正确的自动取消任务的时间</em></div>
    <div class="mt15">
        <label class="xlabel_2">发布任务数量:</label>
        <select name="number" class=" kuang5">
            <?php for($i=1;$i<=100;$i++){ ?>
            <option value="<?php echo $i; ?>" <?php if($tpl->number==$i){ ?>selected<?php } ?>><?php echo $i; ?></option>
            <?php } ?>
        </select>
        <em> 任务一次性发布的数量选择1的话，发布完扣除1个金币，选择2的话发布完扣除2个金币，以此类推。</em></div>
    <div>
    <div>
        <label class="xlabel_2 mt15">上传截图:</label>
        <input type="file" id="fileupload2" style="width:180px;">
        <input type="button" value="上传" onclick="doupload(2);" />
        <input type="hidden" name="auth_thumb" id="img_thumb2" />
        <font color="red">（商家截取任意评论的左半部分，刷手截取右半部分，并计算出评论中实际的文字数量）</font> <span id="lblpicmsg" style="color:Red;"></span>
        <div style="position:relative;">
            <div id="imginfo"><img src=""></div>
        </div>
        <div id="imglist">
            <p class=" ml145 mt15"><img src="<?php if(empty($tpl->auth_thumb)){ ?>/static/images/pinglun.jpg<?php }else{ echo $tpl->auth_thumb; } ?>" id="thumb2" width="360px" height="120px" /></p>
        </div>
    </div>
        <label class="xlabel_2 mt15">保存模板:</label>
        <input type="radio" name="issave" value="1">
        <i>是</i>
        <input type="radio" name="issave" value="2" checked="checked">
        <i>否</i>
         </div>
    <div><input type="submit" value="发布任务" class="btn ml145 mt15">
        <input type="reset" value="重置" class="btn ml32 mt15"></div>
    </form>
</div>

<!--------------弹出框------------------------>

<div class="pay-alert">
    <div class="bg"> <span class="bg-top">
    <p class="order-list"><strong>刷手佣金计算规则</strong></p>
    <p class="false"><a href=""> ｘ</a></p>
    </span>
        <table width="600" height="78" border="1" cellpadding="0" cellspacing="0" bordercolor="#dddddd" class=" mt25 ml25">
            <tr>
                <td width="105" height="40" align="center">商品总金额</td>
                <td width="99" align="center">200元内</td>
                <td width="99" align="center">200－500元</td>
                <td width="99" align="center">500－1000</td>
                <td width="99" align="center">1000－1500</td>
                <td width="99" align="center">每+500</td>
            </tr>
            <tr>
                <td align="center">+佣金</td>
                <td align="center">4元</td>
                <td align="center">5元</td>
                <td align="center">6元</td>
                <td align="center">7元</td>
                <td align="center">+1元</td>
            </tr>
        </table>
        <table width="748" border="1" cellspacing="0" cellpadding="0" bordercolor="#dddddd" align="center" class=" mt15 " >
            <tr>
                <td width="110" height="42" align="center">淘宝号信誉等级</td>
                <td width="59" align="center">白号</td>
                <td width="57" align="center"><img src="/static/images/01.gif" /></td>
                <td width="72" align="center"><img src="/static/images/02.gif" /></td>
                <td width="65" align="center"><img src="/static/images/03.gif" /></td>
                <td width="79" align="center"><img src="/static/images/04.gif" /></td>
                <td width="95" align="center"><img src="/static/images/05.gif" /></td>
                <td width="55" align="center"><img src="/static/images/6.png" /></td>
                <td width="67" align="center"><img src="/static/images/7.png" /></td>
                <td width="67" align="center">每+1钻</td>
            </tr>
            <tr>
                <td height="41" align="center">+佣金</td>
                <td align="center">0元</td>
                <td align="center">1元</td>
                <td align="center">2元</td>
                <td align="center">3元</td>
                <td align="center">3元</td>
                <td align="center">4元</td>
                <td align="center">5元</td>
                <td align="center">6元</td>
                <td align="center">+1元</td>
            </tr>
        </table>
        <div class=" ml25 mt15">
            <p>手机单+1元</p>
            <p class="mt10">增拍店铺宝贝根据选择增拍数对应+佣金（选1+1元，选2就+2元，以此类推）</p>
            </p>
        </div>
    </div>
</div>
<script>
    function areaChangeCallback(id){
        $.post("/task/getcity",{id:id},function(data){
            $('#city').html(data);
        });
    }
    function doupload(n){
        var formData=new FormData();
        formData.append('file',$('input#fileupload'+n)[0].files[0]);
        $.ajax({
            url: '/task/uploadthumb',
            type: 'POST',
            cache: false,
            data: formData,
            dataType:'json',
            processData: false,
            contentType: false
        }).done(function(res) {
            if(res.status==1){
                $('img#thumb'+n).attr('src',res.info);
                $('input#img_thumb'+n).val(res.info);
            }else{
                alert(res.info);
            }
        }).fail(function(res) {
            alert('上传文件失败，请稍候重重试！');
        });
    }
    $(function(){
        $('.pay_btn').click(function(){
            $('.pay-alert').css('display','block');
        })
        $('.false').click(function(){
            $('.pay-alert').css('display','none');
        })
    })
</script>